function IR = cartesianas (I)
 [M N] = size(I);

 Om = (M)/2;                  % co-ordinates of the center of the image
 On = (N)/2;
 sx = (M)/2;                  % scale factors
 sy = (N)/2;
 
 img=zeros(M,N);
 
 R=0.4;
 a=3^(1/M);
 rmin=(a^(-M/2))*R;
 rmax=(a^(M/2))*R;
 
 
for xi = 1:M
  for yi = 1:N
    x = (xi - Om)/sx;
    y = ((-1)*yi + On)/sy;
    
    r= sqrt(x^2 + y^2);
    theta = atan2(y,x);
    if (r >=rmin) && (r <=rmax)
        l1 = abs(floor((log(r/R)/(log(a)))+M/2));
        l2 = abs(floor((N*theta)/pi));
          
        if(l1>=1 && l1<=M) && (l2>=1 && l2<=N)
           img (xi, yi) = I(xi,yi);
           %img (l1,l2) =1;
        end
    end  
  end
end
IR=img;
end
 

